local skel = fk.CreateSkill{
  name = "knu__poshi",
}

Fk:loadTranslationTable{
  ["knu__poshi"] = "破示",
  [":knu__poshi"] = "当你成为伤害牌的目标时，你可以弃置一张【杀】或武器牌，令你或当前回合角色隐匿。",
  ["#knu__poshi"] = "你可以弃置一张【杀】或武器牌，令你或当前回合角色隐匿。",

  ["$knu__poshi1"] = "我之忠心，可破示天地也！",
  ["$knu__poshi2"] = "诸天明鉴，我绝无二心啊！",

}

local DIY = require "packages/diy_utility/diy_utility"

skel:addEffect(fk.TargetConfirming,{
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player and data.card.is_damage_card
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local p = {player}
    if room.current ~= player then
      p = {room.current,player}
    end
    local list = {}
    for _,cid in ipairs(player:getCardIds("he")) do
      local c = Fk:getCardById(cid)
      if (c.name == "slash") or (c.sub_type == Card.SubtypeWeapon) then
        table.insert(list,cid)
      end
    end
    local to,card = room:askToChooseCardsAndPlayers(player,{
      min_card_num = 1,
      max_card_num = 1,
      min_num = 1,
      max_num = 1,
      targets = p,
      skill_name = skel.name,
      prompt = "#knu__poshi",
      cancelable = true,
      will_throw = true,
      pattern = tostring(Exppattern{ id = list }),
    })
    if #card == 1 then
      event:setCostData(self, {tos = to,cards = card})
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local card = event:getCostData(self).cards[1]
    local p = event:getCostData(self).tos[1]
    player.room:throwCard(card,skel.name,player)
    DIY.enterHidden(p)
  end,
})

return skel